{extends 'base/site2.html'}
{block name="page_header"}{include file="common/header.html" inline}{/block}
{block name="page_nav"}{include file="common/slide-nav.html" inline}{/block}
{block name="page_styles"}
<link rel="stylesheet" type="text/css" href="/css/mediation/publiccaseaudit/index.css" />
<style>
    .modal.in .modal-dialog{
        transform: translate(0,50%)!important;
    }
</style>
{/block}
{block name="page_section"}
<div>
    <div class="sessionPage">
        <div class="clearfix page-header">
            <div class="left">
                <span class="line"></span>
                <strong class="tit">公示审核</strong>
            </div>
        </div>
        <form method="get" action="" role="validform" enctype="multipart/form-data" class="small-style">
            <div class="form_row">
                <div class="form-group col-lg-3 ui-select">
                    <label for="exampleInputName2"  class="col-sm-4 control-label">调解部门:</label>
                    <div class="col-sm-7">
                        <select class="form-control selectpicker" name="mediationOrganId">
                            <option class="u144_input_option" {if $query.mediationOrganId == 0}selected="selected"{/if} value="0">全部</option>
                            {foreach from=$mediationOrgan  item=info}
                            <option class="u144_input_option" {if !empty($query.mediationOrganId) &&  $info.id== $query.mediationOrganId}selected="selected"{/if} value="{$info.id}">{$info.name}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>
                <div class="form-group col-lg-3 ui-select">
                    <label class="col-sm-3 control-label text-nowrap">导入时间:</label>
                    <div class="col-sm-7">
                        <input data-ele="date" data-type="daterange" name="add_begin_end" class="form-control" placeholder="请选择" value="{if !empty($smarty.get.add_begin_end)}{$smarty.get.add_begin_end}{/if}" autocomplete="off"/>
                        {* <input data-ele="date" data-type="date" name="add_begin_end" class="form-control" placeholder="请选择" value="{if !empty($query['add_begin_end'])}{$query.add_begin_end}{/if}" autocomplete="off"/>*}
                    </div>
                </div>
                <div class="form-group col-lg-3 ui-select">
                    <label for="exampleInputName2" class="col-sm-4 control-label">导入批次ID:</label>
                    <div class="col-sm-7">
                        <input type="text" class="form-control noempty col-sm-4" value="{$query.importRecordId}" name="importRecordId" placeholder="请输入~">
                    </div>
                </div>

                <div class="form-group col-lg-3 ui-select">
                    <label for="exampleInputName2" class="col-sm-4 control-label">当事人:</label>
                    <div class="col-sm-7">
                        <input type="text" class="form-control noempty col-sm-4" value="{$query.litigantName}" name="litigantName" placeholder="请输入~">
                    </div>
                </div>
            </div>
            <div class="form_row">

                <div class="form-group col-lg-3 ui-select">
                    <label for="exampleInputName2" class="col-sm-4 control-label">身份证号:</label>
                    <div class="col-sm-7">
                        <input type="text" class="form-control noempty col-sm-4" value="{$query.cardId}" name="cardId" placeholder="请输入后6位/全号~">
                    </div>
                </div>
                <div class="form-group col-lg-3 ui-select">
                    <div class="col-lg-5">
                        <button class="btn btn-primary col-lg-8 shousuoBtn "><span class="nav-icon glyphicon glyphicon-search" aria-hidden="true" style="margin-right: 2px"></span>查询</button>
                    </div>
                    <div class="col-lg-5">
                        <a type="button" href="/publiccaseaudit" class="btn btn-default col-lg-8 "><span class="nav-icon glyphicon glyphicon-refresh" aria-hidden="true" style="margin-right: 2px"></span>重置</a>
                    </div>
                </div>
                <div class="ui-select"></div>
                <div class="ui-select"></div>
            </div>
        </form>

        <div style="width: 95%;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            overflow-x: scroll;">
            <table class="table table-striped table-bordered table-hover text-nowrap" id="tab">
                <thead>
                <tr>

                    <th><input type="checkbox" class="checkall" style="vertical-align: text-bottom"></th>
                    <th>导入批次ID</th>
                    <th>调解部门</th>
                    <th>纠纷类型</th>
                    <th>当事人</th>
                    <th>身份证号</th>
                    <th>资产方</th>
                    <th>欠款本金</th>
                    <th>标的金额</th>
                    <th>导入时间</th>

                </thead>
                <tbody>
                {foreach from=$arrList item=item name=foo}
                <tr>
                    <td> <input name="checkItem" class="j-check" type="checkbox" value="{$item.id}"></td>
                    <td>{$item.importRecordId}</td>
                    <td>
                        {$mediationOrgan[$item.mediationOrganId]['name']}
                    </td>
                    <td>
                        {$disputeType[$item.disputeType]}
                    </td>
                    <td>{$item.litigantName}</td>
                    <td>{$item.cardId}</td>
                    <td>{$item.assetsName}</td>
                    <td>{$item.debtPrincipal}</td>
                    <td>{$item.debtTarget}</td>
                    <td>{$item['addTime']|date_format:"%Y-%m-%d %H:%M:%S"}</td>
                </tr>
                {/foreach}
                </tbody>
            </table>
        </div>
        <div class="mr-b20 col-lg-12 pad-no" style="float:none;">
            <input type="button" value="审核通过" data-toggle="modal" data-target="#export_modal_submitCase" class="btn btn-primary casesubmit" case_status="pass">
            <input type="button" value="审核驳回" data-toggle="modal" data-target="#export_modal_submitCase" class="btn btn-primary casesubmit" case_status="reject">
        </div>
        <div class="clearfix pad-no text-nowrap" style="margin-top: 20px;">
            {include file="base/pagenav.html"  action="/publiccaseaudit/index" pagenum=$curPageNum inline}
            <select class="form-control" id="paglimit" style="float:right;margin:0 10px;width: auto;margin-top: -5px;">
                <option value="limit=10" {if $query.limit==10}selected="selected"{/if}>10条/页</option>
                <option value="limit=20" {if $query.limit==20}selected="selected"{/if}>20条/页</option>
                <option value="limit=50" {if $query.limit==50}selected="selected"{/if}>50条/页</option>
                <option value="limit=100" {if $query.limit==100}selected="selected"{/if}>100条/页</option>
                <option value="limit=500" {if $query.limit==500}selected="selected"{/if}>500/页</option>
                <option value="limit=1000" {if $query.limit==1000}selected="selected"{/if}>1000/页</option>
                <option value="limit=2000" {if $query.limit==2000}selected="selected"{/if}>2000/页</option>
            </select>
            <span style="float:right;">标的总额{number_format($debtTotal,2)} 元，本金总额{number_format($debtAmount,2)} 元，共 {$groupTotal} 人，共 {$totalnum} 件</span>
        </div>
    </div>

    <div class="modal fade" id="export_modal_submitCase" tabindex="-1" role="dialog" aria-labelledby="refusal_modal" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
            <div class="modal-content">

                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="exampleModalLabel">案件审核</h4>
                </div>
                <div class="modal-body">
                    <form id="withdraw_form">
                        <p> 即将 <span style="color: green" id="chean_num"></span> 件案件审核 <span style="color: red" id="audit_status"></span> ,请确认是否继续!<p >
                        <input type="hidden" value="" id="case_audit_status" name="case_audit_status">
                    </form>
                </div>
                <div class="modal-footer" style="text-align: center;">
                    <button type="button" class="btn btn-default" id="fpclosebtn" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary distribution">确定</button>
                </div>
            </div>
        </div>
    </div>

    {/block}
    {block name="page_scripts"}
    <script type="text/javascript" src="/js/mediation/publiccaseaudit/index.min.js" init="mediation/publiccaseaudit/index"></script>
    <script type="text/javascript" src="/js/module/date.js"></script>
    <script type="text/javascript">
        $(".casesubmit").on("click",function(){
            var arrbtn = [];
            $(".j-check:checked").each(function (index, ele) {
                //遍历所有复选框，然后取值进行 !非操作
                if ($(this).prop("checked")) {
                    arrbtn.push($(this).val());
                }
            })
            if(arrbtn.length==0){
                toastr.error('请选择案件');
                return false;
            }
            $("#case_audit_status").val($(this).attr('case_status'));

            $("#chean_num").text(arrbtn.length);
            if($(this).attr('case_status') == 'pass'){
                $("#audit_status").text("通过");
            }else{
                $("#audit_status").text("驳回");
            }

        });

        function GetQueryString(name){
            var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if(r!=null)return  unescape(r[2]); return null;
        }
        $('body').on('change','#paglimit', function(){
            console.log()
            var mediationOrganId = GetQueryString('mediationOrganId');
            var paglimit = GetQueryString('limit');
            var source = GetQueryString('source');
            var val =  $(this).val();
            if(!mediationOrganId){
                if(!paglimit && source){
                    window.location = window.location.href+'&'+val;
                }else if(!paglimit){
                    window.location = window.location.href+'?'+val;
                }else{
                    window.location = window.location.href.replace('limit='+paglimit,val);
                }
            }else{
                if(!paglimit){
                    window.location = window.location.href+'&'+val;
                } else{
                    window.location = window.location.href.replace('limit='+paglimit,val);
                }
            }
        })

    </script>
    {/block}
